package com.smh.a02IOStreamDemo2;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CharSetDemo2 {
    public static void main(String[] args) throws FileNotFoundException {


        FileInputStream fis = new FileInputStream("day26-code\\file\\a.txt");
        FileOutputStream fos = new FileOutputStream("day26-code\\file\\b.txt");
        byte[] bytes = new byte[1024];
        try (fos; fis) {//自动释放资源
            int len;
            while ((len = fis.read(bytes)) > 0) {
                fos.write(bytes, 0, len);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
        //拷贝不会有乱码.(因为,数据没有丢失,记事本在解码时和编码一样,不会出现乱码)

    }
}
